#include<iostream>

using namespace std;

pair<int, int> A[5000];

int Partition(int low, int high)
{
	pair<int, int> pivot = A[low];
	while (low < high)
		//
		// || (A[low].second = pivot.second && A[low].first < pivot.first)
	{
		while (low < high && ((A[high].second < pivot.second) || (A[high].second == pivot.second && A[high].first > pivot.first)) ) 
			--high;
		A[low].first = A[high].first;
		A[low].second = A[high].second;
		while (low < high && ((A[low].second > pivot.second) || (A[low].second == pivot.second && A[low].first <= pivot.first)) )
			++low;
		A[high].first = A[low].first;
		A[high].second = A[low].second;
	}
	A[low] = pivot;
	return low;
}


void QuickSort(int low, int high)
{
	if (low < high)
	{
		int pivotpos = Partition(low, high);
		QuickSort(low, pivotpos - 1);
		QuickSort(pivotpos + 1, high);

	}
}


int main()
{
	
	pair<int, int> temp_pair;
	int n, m, temp_num, temp_point;

	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		cin >> temp_num >> temp_point;
		temp_pair = pair<int, int>(temp_num, temp_point);
		A[i] = temp_pair;
	}
	QuickSort( 0, n-1);
	int max, j;
	m * 1.5 > n ? max = n : max = m * 1.5;
	j = max + 1 - 1;
	while (true)
	{
		if (A[j].second != A[j - 1].second || j >= n) break;
		max++;
		j++;
	}
	cout << A[max - 1].second << " " << max << endl;
	for (int i = 0; i < max; i++)
	{
		cout << A[i].first << " "<< A[i].second << endl;
	}
	return 0;
}